{include file="public/meta" /}
<title>订单管理</title>
</head>
<body>
<!--_header 作为公共模版分离出去-->
{include file="public/header" /}
<!--/_header 作为公共模版分离出去-->
<!--_menu 作为公共模版分离出去-->
{include file="public/leftmenu" /}
<!--/_menu 作为公共模版分离出去-->
<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> <a href="{:url('Index/index')}">首页</a> <span class="c-gray en">&gt;</span> 订单管理 <span class="c-gray en">&gt;</span> 订单列表<a id="btn-refresh" class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="Hui-article">
        <article class="cl pd-20">
            <form >
                <div class="text-c">
                    订单状态 :
                    <span class="select-box" style="width: 100px; ">
					<select name="status" class="select">
						<option value="">全部</option>
                        <option {if condition="($status neq '') && ($status eq 0)"}selected{/if} value="0">待付款</option>
                        <option {if condition="$status eq 1"}selected{/if} value="1">待发货</option>
                        <option {if condition="$status eq 2"}selected{/if} value="2">待收货</option>
                        <option {if condition="$status eq 5"}selected{/if} value="5">交易完成</option>
					</select>
                        </span>日期范围：
                    <input type="text" onfocus="WdatePicker()" value="{:input('logmin')}" name="logmin" class="input-text Wdate" style="width:120px;">
                    -
                    <input type="text" onfocus="WdatePicker()" value="{:input('logmax')}" name="logmax" class="input-text Wdate" style="width:120px;">
                    <input type="text" class="input-text" style="width:250px" placeholder="输入会员昵称、手机号、订单编号" name="keywords" value="{:input('keywords')}">
                    <button type="submit" class="btn btn-success radius" ><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
                </div>
            </form>
            <div class="mt-20">
                <table class="table table-border table-bordered table-hover table-bg ">
                    <thead>
                    <tr class="text-c">
                        <th width="40"><input name="" type="checkbox" value=""></th>
                        <th width="40">ID</th>
                        <th width="70">订单号</th>
                        <th width="150">购买用户</th>
                        <th width="50">订单金额</th>
                        <th width="50">优惠抵扣</th>
                        <th width="50">运费</th>
                        <th width="50">抵扣金额</th>
                        <th width="50">付款金额</th>
                        <th width="60">下单时间</th>
                        <th width="60">交易状态</th>
                        <th width="100">操作</th>
                    </tr>
                    </thead>
                    {volist name="list" id="val"}
                    <tbody>
                    <tr class="text-c">
                        <td><input type="checkbox" value="1" name=""></td>
                        <td>{$val['id']}</td>
                        <td>{$val['order_no']}</td>
                        <td>{$val['user_nickname']} - - {$val['true_name']}</td>
                        <td>{$val['sum']}</td>
                        <td>{$val['coupon_money']}</td>
                        <td>{$val['cost']}</td>
                        <td>{$val['balance']}</td>
                        <td>{$val['pay_money']}</td>
                        <td>{$val['add_time']}</td>
                        <td>
                            {switch name="val.status"}
                                {case value="0"}待支付{/case}
                                {case value="1"}<span style="color: red">待发货</span>{/case}
                                {case value="2"}<span style="color: #dd514c">等待用户收货</span>{/case}
                                {case value="5"}<span style="color: #9c9c9c">交易完成</span>{/case}
                            {/switch}
                        </td>
                        <td class="td-manage">
                            {eq name="val.status" value="0"}
                            <a title="删除" href="javascript:;" onclick="order_del(this,'{$val['id']}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">删除</i></a>
                            {/eq}
                            {eq name="val.status" value="1"}
                            <a title="立即发货" href="javascript:;" onclick="send_goods('立即发货','{:url('Order/sendGoods')}','{$val.id}','','500')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">发货</i></a>
                            {/eq}
                            <a title="订单详情" href="javascript:;" onclick="order_info('订单详情','{:url('Order/orderInfo')}','{$val.id}','','500')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">订单详情</i></a>

                        </td>
                    </tr>
                    </tbody>
                    {/volist}
                </table>
                <div class="bjwl_paginate">
                    {$list->render()}
                </div>
            </div>
        </article>
    </div>
</section>
<!--_footer 作为公共模版分离出去-->
{include file="public/footer" /}
<!--/_footer /作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__LIB__/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__LIB__/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__LIB__/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    $(function(){
        $('.table-sort').dataTable({
            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,7]}// 制定列不参与排序
            ]
        });
        $('.table-sort tbody').on( 'click', 'tr', function () {
            if ( $(this).hasClass('selected') ) {
                $(this).removeClass('selected');
            }
            else {
                $('tr.selected').removeClass('selected');
                $(this).addClass('selected');
            }
        });

    });
    /*订单详情*/
    function order_info(title,url,id,w,h){
        layer_show_id(title,url,id,w,h);
    }
    /*立即发货*/
    function send_goods(title,url,id,w,h) {
        layer_show_id(title,url,id,w,h);
    }
    /*删除*/
    function order_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                url:"{:url('Order/del')}",
                type:'post',
                data:{
                    'id':id
                },
                dataType:'json',
                success:function(data){
                    if(data.code==0) {
                        $(obj).parents("tr").remove();
                        layer.msg(data.msg,{icon:6,time:1000});
                    } else{
                        layer.msg(data.msg,{icon:5,time:1000});
                    }
                },
                error:function(data){
                    layer.msg(data.msg,{icon:5,time:1000});
                }
            });
        });
    }
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>